<!--报销金额-->
<!doctype html>
<html lang="zh-CN" xmlns="http://www.w3.org/1999/html">
<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="../css/common.css">
    <link rel="stylesheet" href="../css/main.css">
    <link rel="stylesheet" href="../css/city-picker.css">
    <link rel="stylesheet" href="../css/jquery-ui.css">
    <link rel="stylesheet" href="../css/jquery-ui-timepicker-addon.css"/>
    <link rel="stylesheet" href="../css/jquery-ui.css"/>
    <link href="../css/bootstrap.css" rel="stylesheet" type="text/css" />
    <link href="../css/city-picker.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="../css/jquery-impromptu.min.css" type="text/css"/>
    <title>Document</title>
    <style>
        .checkbox{
            margin: 0px;
            display: inline-block;
        }
    </style>
</head>
<body>
<div class="box">
    <div class="box_border">
        <div class="box_top" onclick="oilToggle()"><b class="pl15">油价标准</b>
        </div>
        <div class="mt10 mb10" id="oilDiv">
            <div  class="mt10">
                <div class="box span9 oh" style="margin-left: auto; margin-right: auto">
                    <table id="oilTable" width="100%" border="0" cellpadding="0" cellspacing="0" class="list_table" style="table-layout:fixed; font-size:1.2rem">
                        <tr >
                            <th class="td_center" >油价(元)</th>
                            <th class="td_center" >百公里油耗(L/Km)</th>
                            <th class="td_center" >操作</th>
                        </tr>
                        <tbody id="oilBody" style="text-align: center;">
                        </tbody>
                    </table>
                    <div id="oilDialog" style="display: none;">
                        <form name="oilForm" >
                        <div class="pb10 mb15"> <div style="display: inline;width:100px;text-align: right;">油价:</div>
                            <input type="text" name="oilPrice" class="input-text lh30 ml"  id="oilPrice" size="28"  onkeyup="value=value.replace(/[^\d.]/g,'')" >&nbsp;元/L</div>
                        <div class="pb10"> <div style="display: inline;width:100px;text-align: right;"   >油耗:</div>
                            <input type="text" name="oilCount" class="input-text lh30 ml" id="oilCount" size="28" onkeyup="value=value.replace(/[^\d.]/g,'')"  >&nbsp;L/Km</div>
                            </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="box">
    <div class="box_border">
        <div class="box_top" onclick="publicExpenseToggle()"><b class="pl15">伙食标准</b></div>
        <div class="mt10 mb10" id="publicExpenseDiv">
            <div  class="mt10">
                <div class="box span9 oh" style="margin-left: auto; margin-right: auto">
                    <table id="publicExpenseTable" width="100%" border="0" cellpadding="0" cellspacing="0" class="list_table" style="table-layout:fixed; font-size:1.2rem">
                        <tr >
                            <th class="td_center" >本地吃饭补助</th>
                            <th class="td_center" >本地公杂费补助</th>
                            <th class="td_center" >区外省内吃饭补助</th>
                            <th class="td_center" >省外食宿费补助</th>
                            <th class="td_center" >区外省内公杂费补助</th>
                            <th class="td_center" >省外公杂费补助</th>
                            <th class="td_center" >操作</th>
                        </tr>
                        <tbody id="publicExpenseBody" style="text-align: center;">
                        </tbody>
                    </table><div id="publicExpenseDialog" style="display: none;">
                    <form name="publicExpenseForm" >
                        <div class="pb10 "> <div style="display: inline-block;width:130px;text-align: right;">本地吃饭补助:</div>
                            <input type="text" name="local_food_subsidy" class="input-text lh30 ml"  id="local_food_subsidy" size="30"  onkeyup="value=value.replace(/[^\d.]/g,'')" ><span style="color: red;">*</span></div>
                        <div class="pb10"> <div style="display:inline-block;width:130px;text-align: right;"   >本地公杂费补助:</div>
                            <input type="text" name="local_public_expense" class="input-text lh30 ml" id="local_public_expense" size="30" onkeyup="value=value.replace(/[^\d.]/g,'')"  ><span style="color: red;">*</span></div>
                        <div class="pb10 "> <div style="display:inline-block;width:130px;text-align: right;">区外省内吃饭补助:</div>
                            <input type="text" name="province_food_subsidy" class="input-text lh30 ml"  id="province_food_subsidy" size="30"  onkeyup="value=value.replace(/[^\d.]/g,'')" ><span style="color: red;">*</span></div>
                        <div class="pb10"> <div style="display:inline-block;width:130px;text-align: right;"   >省外食宿费补助:</div>
                            <input type="text" name="outprovince_food_subsidy" class="input-text lh30 ml" id="outprovince_food_subsidy" size="30" onkeyup="value=value.replace(/[^\d.]/g,'')"  ><span style="color: red;">*</span></div>
                        <div class="pb10 "> <div style="display:inline-block;width:130px;text-align: right;">区外省内公杂费补助:</div>
                            <input type="text" name="province_public_expense" class="input-text lh30 ml"  id="province_public_expense" size="30"  onkeyup="value=value.replace(/[^\d.]/g,'')" ><span style="color: red;">*</span></div>
                        <div class="pb10"> <div style="display:inline-block;width:130px;text-align: right;"   >省外公杂费补助:</div>
                            <input type="text" name="outprovice_public_expense" class="input-text lh30 ml" id="outprovice_public_expense" size="30" onkeyup="value=value.replace(/[^\d.]/g,'')"  ><span style="color: red;">*</span></div>
                    </form>
                </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="box">
    <div class="box_border">
        <div class="box_top" onclick="hotelMoneyToggle()"><b class="pl15">住宿标准</b></div>
        <div id="hotelMoneyDiv" >
        <div class="box_center pt10 pb10"   style="padding-left: 35%;">
            <table class="form_table" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <div class="form-group" style="width:350px; float: left">
                        <div style="position: relative;">
                            <input id="city-picker3" class="form-control" readonly type="text" value="四川省/宜宾市/翠屏区" data-toggle="city-picker">
                        </div>
                    </div>
                    <td><input type="button" value="搜索" class="ext_btn ext_btn_submit" onclick="searchTable()"></td>
                    <!--<td><input type="button" value="编辑"  class="ext_btn ext_btn_submit" onclick="editHotelMoney()">-->
                        <div id="dialog1" title="" style="display:none;">
                                <form name="from1" >
                                    <div class="pb10 mb15"> <div style="display: inline-block;width:100px;text-align: right;">厅局级淡季:</div>
                                        <input type="text" name="Bureau_light" class="input-text lh30 ml" id="Bureau_light" size="30"  onkeyup="value=value.replace(/[^\d]/g,'')" ></div>
                                    <div class="pb10 mb15"> <div style="display: inline-block;width:100px;text-align: right;"  onkeyup="value=value.replace(/[^\d]/g,'')" >其他人员淡季:</div>
                                        <input type="text" name="others_light" class="input-text lh30 ml" id="others_light" size="30" onkeyup="value=value.replace(/[^\d]/g,'')"  ></div>
                                    <div class="pb10 mb15"> <div style="display: inline-block;width:100px;text-align: right;" onkeyup="value=value.replace(/[^\d]/g,'')" >厅局级旺季:</div>
                                        <input type="text" name="Bureau_fire" class="input-text lh30 ml" id="Bureau_fire" size="30" onkeyup="value=value.replace(/[^\d]/g,'')"  ></div>
                                    <div class="pb10 mb15 "> <div style="display: inline-block;width:100px;text-align: right;" onkeyup="value=value.replace(/[^\d]/g,'')" >其他人员旺季:</div>
                                        <input type="text" name="others_fire" class="input-text lh30 ml" size="30" id="others_fire" onkeyup="value=value.replace(/[^\d]/g,'')"   ></div>
                                    <div ><div style="display: inline-block;width:100px;text-align: right;" onkeyup="value=value.replace(/[^\d]/g,'')"  > 旺季时间(月):</div>
                                        <!--<input type="text" name="fire_time" class="input-text lh30 ml" size="30" id="card_number" ></div>-->
                                        <input class=" checkbox"  type="checkbox" name="fire_time" value="1" style="margin-bottom: 9px;margin-left: 10px;">1&nbsp;
                                        <input class="checkbox"  type="checkbox" name="fire_time" value="2">2&nbsp;
                                        <input class="checkbox"  type="checkbox" name="fire_time" value="3">3&nbsp;
                                        <input class="checkbox"  type="checkbox" name="fire_time" value="4">4&nbsp;&nbsp;
                                        <input class="checkbox"  type="checkbox" name="fire_time" value="5">5&nbsp;&nbsp;
                                        <input class="checkbox"  type="checkbox" name="fire_time" value="6">6&nbsp;&nbsp;
                                    </div>
                                        <div ><div style="display: inline-block;width:100px;text-align: right;" onkeyup="value=value.replace(/[^\d]/g,'')"  > </div>
                                        <input class="checkbox"  type="checkbox" name="fire_time" value="7" style="margin-bottom: 9px;margin-left: 10px;">7&nbsp;
                                        <input class="checkbox"  type="checkbox" name="fire_time" value="8">8&nbsp;
                                        <input class="checkbox"  type="checkbox" name="fire_time" value="9">9&nbsp;
                                        <input class="checkbox"  type="checkbox" name="fire_time" value="10">10
                                        <input class="checkbox"  type="checkbox" name="fire_time" value="11">11
                                        <input class="checkbox"  type="checkbox" name="fire_time" value="12">12
                                        </div>
                                    <!--<input type="button" id="back" value="删除" class="ext_btn ext_btn_submit">-->
                                    <!--<input type="submit" id="save" value="保存" class="ext_btn ext_btn_submit">-->
                                </form>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    <div class="box_border" style="border-bottom: none;">
        <div style="clear: both;"></div>
        <div class="mt10">
            <div id="table" class="mt10">
                <div class="box span9 oh" style="margin-left: auto; margin-right: auto">
                    <table id="approval_info1" width="100%" border="0" cellpadding="0" cellspacing="0" class="list_table" style="table-layout:fixed; font-size:1.2rem">
                        <tr>
                            <th class="td_center" >序号</th>
                            <th class="td_center" >地区</th>
                            <th class="td_center" >厅局级淡季</th>
                            <th class="td_center" >其他人员淡季</th>
                            <th class="td_center" >厅局级旺季</th>
                            <th class="td_center" >其他人员旺季</th>
                            <th class="td_center" >旺季时间</th>
                            <th class="td_center" >操作</th>
                        </tr>
                        <tbody id="approval_info">
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
        </div>
    </div>
</div>
<div id="info" style="text-align: center;"></div>
</body>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/jquery-ui.js"></script>
<script type="text/javascript" src="../js/common.js"></script>
<script type="text/javascript" src="../js/city-picker.data.js"></script>
<script type="text/javascript" src="../js/city-picker.js"></script>
<script type="text/javascript" src="../js/config.js"></script>
<script type="text/javascript">
    //显示住宿补贴
    function hotelMoneyToggle(){
        $("#hotelMoneyDiv").slideToggle();
    }
    //编辑
    function editHotelMoney(regionID){
        var phpUrl=url +'admin/HotelMoney/HotelMoneyGetData.php';
//        alert(1);
        $.ajax({
            url:phpUrl,
            type: "POST",
//            async:false,
            data:{model:'getHotelMoney',city_ID:regionID},
            success:function(getData){
//                alert(getData);
                getData=JSON.parse(getData);
                getData=getData['data'];
                var from1=$('form[name="from1"]')[0];
//                from1.Bureau_light.value=getData[0].bureau_light;
                $("#Bureau_light").val(getData[0].bureau_light);
                $("#others_light").val(getData[0].bureau_light);
                $("#Bureau_fire").val(getData[0].others_light);
                $("#others_fire").val(getData[0].others_fire);
                var fireTime=getData[0].fire_time;
//                alert(fireTime);
                if(fireTime!='') {
                    fireTime=fireTime.split(',');
                    for(var i=0;i<fireTime.length;i++){
                        $("input[name='fire_time']")[fireTime[i]-1].checked=true;
                    }
                }
//                alert(2);
                $( "#dialog1" ).dialog({
                    title:getData[0].city_name+'-单位(元)',
                    width: 500,
                    resizable: false,
                    modal: true,
                    buttons: {
                        "取消": function() {
                            $( this ).dialog( "close" );
                        },
                        "保存": function() {
                            var from2=document.from1;
                            var fireOneTime=$("input[name='fire_time']");
                            var fire_time='';
//                            alert(1);
                            for(var j=0;j<fireOneTime.length;j++)
                            if(fireOneTime[j].checked){
                                if(fire_time=='')
                                    fire_time=fireOneTime[j].value;
                                else
                                    fire_time+=','+fireOneTime[j].value;
                            }
//                            alert(1);
//                            alert($("#Bureau_light").val());
                            phpUrl=url +'admin/HotelMoney/HotelMoneyUpdateData.php';
                            var hotelData={
                                model:'updateHotelMoney',
                                city_ID:regionID,
                                bureau_light:$("#Bureau_light").val(),
                                others_light:$("#others_light").val(),
                                bureau_fire:$("#Bureau_fire").val(),
                                others_fire:$("#others_fire").val(),
                                fire_time:fire_time
                            };
                            $.ajax({
                                url:phpUrl,
                                type:'POST',
                                data:hotelData,
                                success: function (state) {
//                                    alert(state);
                                    state=JSON.parse(state);
//                                    alert(state['state']);
                                    if(state['state']==1)
                                        document.getElementById('info').innerHTML='修改成功！';
                                    else
                                        document.getElementById('info').innerHTML='修改失败！';
                                    $("#info").dialog({
                                        resizable: false,
                                        title: "信息",
                                        modal: true,
                                        buttons: {
                                            '确定': function () {
                                                $("#info").dialog("close");
                                            }
                                        }
                                    });
                                    searchTable();
                                    setTimeout('closeDialog()',1000);
                                }
                            });
                            //传输局给服务器



                            // alert(document.getElementById("dialog1").title);
                            //alert(regionIdArry[regionIdArry.length-1]);
                            $( this ).dialog( "close" );
                        }
                    }
                });
            }
        });
       // window.location='hotel_moneymanger_info.html';
    }
    function searchTable(){
        var phpUrl=url+'admin/HotelMoney/HotelMoneyGetData.php';
        var regionId=$('#city-picker3').data('citypicker').getCode();
        regionId=regionId.split('/');
        regionId=regionId[regionId.length-1];
//        alert(regionId);
//       alert(phpUrl);
        $.ajax({
            url:phpUrl,
            type: "POST",
            data:{model:'getHotelMoney',city_ID: regionId},
            success:function(getData){
//               alert(getData);
                getData=JSON.parse(getData);
                getData=getData.data;
//                alert(getData.length);
                $("#approval_info").empty();
                for(var i=0;i<getData.length;i++) {
                    if(getData[i]['fire_time']==null) getData[i]['fire_time']='';
                    $("#approval_info").append(
                            '<tr><td class="td_center" >' + getData[i]['city_ID'] + '</td>' +
                            '<td class="td_center  " >' + getData[i]['city_name'] + '</td>' +
                            '<td class="td_center  " >' + getData[i]['bureau_light'] + '</td>' +
                            '<td class="td_center  " >' + getData[i]['others_light'] + '</td>' +
                            '<td class="td_center  " >' + getData[i]['bureau_fire'] + '</td>' +
                            '<td class="td_center  " >' + getData[i]['others_fire'] + '</td>' +
                            '<td class="td_center  " >' + getData[i]['fire_time'] + '</td>'+
                    '<td class="td_center"><a class="ext_btn modify"  onclick="editHotelMoney('+getData[i]['city_ID']+')" ><span class="modify" ></span>编辑</a></td></tr>'
                    );
                }
            }});
    }
//油价显示
function oilToggle(){
//    alert(1);
    $("#oilDiv").slideToggle();
}
//公杂费显示
function publicExpenseToggle(){
    $("#publicExpenseDiv").slideToggle();
}
//油价加载
    function createOilTable(){
        var phpUrl=url+'admin/HotelMoney/HotelMoneyGetOil.php';
        $.ajax({
            url:phpUrl,
            type:"POST",
            data:{model:"getOilData"},
            success: function (data) {
//                alert(data);
                data=JSON.parse(data);
                if(data.state==1){
//                    alert(1);
                    $("#oilBody").empty().append(
                            '<tr><td>'+data.data.price+'</td>' +
                            '<td>'+data.data.count+'</td>'+
                            '<td><a class="ext_btn modify"  onclick="editOil(this)"  ><span class="modify" ></span>编辑</a></td></tr>'
                    );
                }
            }
        });
    }
//编辑油价
    function editOil(e){
        var phpUrl=url+'admin/HotelMoney/HotelMoneyUpdateOil.php';
        var thisTr=e.parentNode.parentNode;
        var price=thisTr.childNodes[0].innerHTML;
        var count=thisTr.childNodes[1].innerHTML;
        $("#oilPrice").val(price);
        $("#oilCount").val(count);
        $("#oilDialog").dialog({
            width:330,
            title:"油价设置",
            resizeable:false,
            buttons:{
                '取消': function () {
                    $("#oilDialog").dialog('close');
                },
                '保存': function () {
                    var oilPrice=$("#oilPrice").val();
                    var oilCount=$("#oilCount").val();
//                    alert(oilPrice+':'+oilCount);
                    if(oilPrice==''||oilCount=='') dialogInfo('数据不完整！');
                    else{
                        $.ajax({
                            url:phpUrl,
                            type:"POST",
                            data:{model:"updateOil",price:oilPrice,count:oilCount},
                            success: function (data) {
//                                alert(data);
                                data=JSON.parse(data);
                                if(data.state==1) {
                                    dialogInfo('保存成功！');
                                    $("#oilDialog").dialog('close');
                                    createOilTable();
                                }
                                else {
                                    dialogInfo('保存失败！');
                                }
                            }
                        });
                    }
                }
            }
        });
    }
    //公杂费加载
    function createPublicExpenseTable(){
        var phpUrl=url+'admin/HotelMoney/HotelMoneyGetPubliceExpenseData.php';
        $.ajax({
            url:phpUrl,
            type:"POST",
            data:{model:"getPublicExpenseData"},
            success: function (data) {
//                alert(data);
                data=JSON.parse(data);
                if(data.state==1){
//                    alert(1);
                    $("#publicExpenseBody").empty().append(
                            '<tr><td>'+data.data.local_food_subsidy+'</td>' +
                            '<td>'+data.data.local_public_expense+'</td>'+
                            '<td>'+data.data.province_food_subsidy+'</td>'+
                            '<td>'+data.data.outprovince_food_subsidy+'</td>'+
                            '<td>'+data.data.province_public_expense+'</td>'+
                            '<td>'+data.data.outprovice_public_expense+'</td>'+
                            '<td><a class="ext_btn modify"  onclick="editPublicExpense(this)"  ><span class="modify" ></span>编辑</a></td></tr>'
                    );
                }
            }
        });
    }
    //编辑公杂费
    function editPublicExpense(e){
        var phpUrl=url+'admin/HotelMoney/HotelMoneyUpdatePubliceExpenseData.php';
        var publicExpenseForm=document.publicExpenseForm;
        var thisTr=e.parentNode.parentNode;
        publicExpenseForm.local_food_subsidy.value=thisTr.childNodes[0].innerHTML;
        publicExpenseForm.local_public_expense.value=thisTr.childNodes[1].innerHTML;
        publicExpenseForm.province_food_subsidy.value=thisTr.childNodes[2].innerHTML;
        publicExpenseForm.outprovince_food_subsidy.value=thisTr.childNodes[3].innerHTML;
        publicExpenseForm.province_public_expense.value=thisTr.childNodes[4].innerHTML;
        publicExpenseForm.outprovice_public_expense.value=thisTr.childNodes[5].innerHTML;
        $("#publicExpenseDialog").dialog({
            title:"公杂费设置-单位(元)",
            width:410,
            resizable: false,
            modal: true,
            buttons: {
                '取消': function () {
                    $("#publicExpenseDialog").dialog("close");
                },
                '保存': function () {

//                    alert(publicExpenseForm.local_food_subsidy.value);
//                    $("#publicExpenseDialog").dialog("close");
                    var local_food_subsidy=publicExpenseForm.local_food_subsidy.value;
                    var local_public_expense=publicExpenseForm.local_public_expense.value;
                    var province_food_subsidy=publicExpenseForm.province_food_subsidy.value;
                    var outprovince_food_subsidy=publicExpenseForm.outprovince_food_subsidy.value;
                    var province_public_expense=publicExpenseForm.province_public_expense.value;
                    var outprovice_public_expense=publicExpenseForm.outprovice_public_expense.value;
                    if(local_food_subsidy==''||local_public_expense==''||province_food_subsidy==''||outprovince_food_subsidy==''||province_public_expense==''||outprovice_public_expense=='') dialogInfo('内容不完整！');
                    else{
                        $.ajax({
                            url:phpUrl,
                            type:"POST",
                            data:{model:"updatePublicExpenseData",local_food_subsidy:local_food_subsidy,local_public_expense:local_public_expense,province_food_subsidy:province_food_subsidy,outprovince_food_subsidy:outprovince_food_subsidy,province_public_expense:province_public_expense,outprovice_public_expense:outprovice_public_expense},
                            success: function (data) {
                                data=JSON.parse(data);
                                if(data.state==1) {
                                    $("#publicExpenseDialog").dialog("close");
                                    dialogInfo("保存成功！");
                                    createPublicExpenseTable();
                                }else
                                {
                                    dialogInfo("保存失败！");
                                }
                            }
                        });
                    }
                }
            }
        });
    }
    //信息提醒函数
    function dialogInfo(e){
        document.getElementById('info').innerHTML=e;
        $("#info").dialog({
            resizable: false,
            title: "信息",
            modal: true,
            buttons: {
                '确定': function () {
                    $("#info").dialog("close");
                }
            }
        });
        setTimeout('closeDialog()',1000);
    }
    //关闭提示窗
    function closeDialog(){
        $("#info").dialog("close");
    }
//限制输入只能为数字
    function keyPress() {
       var keyCode = event.keyCode;
      if ((keyCode >= 48 && keyCode <= 57))
      {
          event.returnValue = true;
       } else {
        event.returnValue = false;
       }
   }
    $(function () {

        searchTable();
//        oilToggle();
//        publicExpenseToggle();
        createOilTable();
        createPublicExpenseTable();
    });
</script>
</html>
  